﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Ionic.Zip;

namespace Furesoft.Addins
{
    public class RuntimeFolder
    {
        private List<ZipEntry> entries;

        public List<string> Entries { get; set; }

        public RuntimeFolder()
        {
            entries = new List<ZipEntry>();

            foreach (var e in entries)
            {
                Entries.Add(e.FileName);
            }
        }

        public MemoryStream GetEntry(string name)
        {
            MemoryStream ms = new MemoryStream();

            foreach (var item in entries)
            {
                if (item.FileName == name)
                {
                    item.Extract(ms);
                }
            }

            return ms;
        }
    }
}